home *** CD-ROM | disk | FTP | other *** search
/ PD Collection CD 1 / PD Collection CD 1.iso / textual / pdftops / xpdf / h / Lexer < prev    next >
Text File  |  1996-06-08  |  1KB  |  57 lines

  1. //========================================================================
  2. //
  3. // Lexer.h
  4. //
  5. // Copyright 1996 Derek B. Noonburg
  6. //
  7. //========================================================================
  8.  
  9. #ifndef LEXER_H
  10. #define LEXER_H
  11.  
  12. #ifdef __GNUC__
  13. //#pragma interface
  14. #endif
  15.  
  16. #include "Object.h"
  17. #include "Stream.h"
  18.  
  19. #define maxTokenLen 255
  20.  
  21. //------------------------------------------------------------------------
  22. // Lexer
  23. //------------------------------------------------------------------------
  24.  
  25. class Lexer {
  26. public:
  27.  
  28.   // Constructor.
  29.   Lexer(Stream *str1, GBool freeStream1 = gTrue);
  30.  
  31.   // Destructor.
  32.   ~Lexer();
  33.  
  34.   // Get the next object from the input stream.
  35.   Object *getObj(Object *obj);
  36.  
  37.   // Skip to the next line in the input stream.
  38.   void skipToNextLine();
  39.  
  40.   // Get stream.
  41.   Stream *getStream() { return str; }
  42.  
  43.   // Get current position in file.
  44.   int getPos() { return str->getPos(); }
  45.  
  46. private:
  47.  
  48.   Stream *str;            // input stream
  49.   int buf;            // next character
  50.   GBool cr, lf;            // used for filtering CR/LF
  51.   GBool freeStream;        // should Lexer free the Stream?
  52.  
  53.   int getChar();
  54. };
  55.  
  56. #endif
  57.